\(\int \frac {\sqrt {1+x}}{\sqrt {1-x}} \, dx\) [1068]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [B] (verification not implemented)
   Sympy [C] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 17, antiderivative size = 21 \[ \int \frac {\sqrt {1+x}}{\sqrt {1-x}} \, dx=-\sqrt {1-x} \sqrt {1+x}+\arcsin (x) \]

[Out]

arcsin(x)-(1-x)^(1/2)*(1+x)^(1/2)

Rubi [A] (verified)

Time = 0.00 (sec) , antiderivative size = 21, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.176, Rules used = {52, 41, 222} \[ \int \frac {\sqrt {1+x}}{\sqrt {1-x}} \, dx=\arcsin (x)-\sqrt {1-x} \sqrt {x+1} \]

[In]

Int[Sqrt[1 + x]/Sqrt[1 - x],x]

[Out]

-(Sqrt[1 - x]*Sqrt[1 + x]) + ArcSin[x]

Rule 41

Int[((a_) + (b_.)*(x_))^(m_.)*((c_) + (d_.)*(x_))^(m_.), x_Symbol] :> Int[(a*c + b*d*x^2)^m, x] /; FreeQ[{a, b
, c, d, m}, x] && EqQ[b*c + a*d, 0] && (IntegerQ[m] || (GtQ[a, 0] && GtQ[c, 0]))

Rule 52

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(a + b*x)^(m + 1)*((c + d*x)^n/(b*(
m + n + 1))), x] + Dist[n*((b*c - a*d)/(b*(m + n + 1))), Int[(a + b*x)^m*(c + d*x)^(n - 1), x], x] /; FreeQ[{a
, b, c, d}, x] && NeQ[b*c - a*d, 0] && GtQ[n, 0] && NeQ[m + n + 1, 0] &&  !(IGtQ[m, 0] && ( !IntegerQ[n] || (G
tQ[m, 0] && LtQ[m - n, 0]))) &&  !ILtQ[m + n + 2, 0] && IntLinearQ[a, b, c, d, m, n, x]

Rule 222

Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Simp[ArcSin[Rt[-b, 2]*(x/Sqrt[a])]/Rt[-b, 2], x] /; FreeQ[{a, b}
, x] && GtQ[a, 0] && NegQ[b]

Rubi steps \begin{align*} \text {integral}& = -\sqrt {1-x} \sqrt {1+x}+\int \frac {1}{\sqrt {1-x} \sqrt {1+x}} \, dx \\ & = -\sqrt {1-x} \sqrt {1+x}+\int \frac {1}{\sqrt {1-x^2}} \, dx \\ & = -\sqrt {1-x} \sqrt {1+x}+\sin ^{-1}(x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 34, normalized size of antiderivative = 1.62 \[ \int \frac {\sqrt {1+x}}{\sqrt {1-x}} \, dx=-\sqrt {1-x^2}-2 \arctan \left (\frac {\sqrt {1-x^2}}{-1+x}\right ) \]

[In]

Integrate[Sqrt[1 + x]/Sqrt[1 - x],x]

[Out]

-Sqrt[1 - x^2] - 2*ArcTan[Sqrt[1 - x^2]/(-1 + x)]

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(41\) vs. \(2(17)=34\).

Time = 0.16 (sec) , antiderivative size = 42, normalized size of antiderivative = 2.00

method result size
default \(-\sqrt {1-x}\, \sqrt {1+x}+\frac {\sqrt {\left (1+x \right ) \left (1-x \right )}\, \arcsin \left (x \right )}{\sqrt {1+x}\, \sqrt {1-x}}\) \(42\)
risch \(\frac {\left (-1+x \right ) \sqrt {1+x}\, \sqrt {\left (1+x \right ) \left (1-x \right )}}{\sqrt {-\left (-1+x \right ) \left (1+x \right )}\, \sqrt {1-x}}+\frac {\sqrt {\left (1+x \right ) \left (1-x \right )}\, \arcsin \left (x \right )}{\sqrt {1+x}\, \sqrt {1-x}}\) \(65\)

[In]

int((1+x)^(1/2)/(1-x)^(1/2),x,method=_RETURNVERBOSE)

[Out]

-(1-x)^(1/2)*(1+x)^(1/2)+((1+x)*(1-x))^(1/2)/(1+x)^(1/2)/(1-x)^(1/2)*arcsin(x)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 37 vs. \(2 (17) = 34\).

Time = 0.22 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.76 \[ \int \frac {\sqrt {1+x}}{\sqrt {1-x}} \, dx=-\sqrt {x + 1} \sqrt {-x + 1} - 2 \, \arctan \left (\frac {\sqrt {x + 1} \sqrt {-x + 1} - 1}{x}\right ) \]

[In]

integrate((1+x)^(1/2)/(1-x)^(1/2),x, algorithm="fricas")

[Out]

-sqrt(x + 1)*sqrt(-x + 1) - 2*arctan((sqrt(x + 1)*sqrt(-x + 1) - 1)/x)

Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 1.88 (sec) , antiderivative size = 99, normalized size of antiderivative = 4.71 \[ \int \frac {\sqrt {1+x}}{\sqrt {1-x}} \, dx=\begin {cases} - 2 i \operatorname {acosh}{\left (\frac {\sqrt {2} \sqrt {x + 1}}{2} \right )} - \frac {i \left (x + 1\right )^{\frac {3}{2}}}{\sqrt {x - 1}} + \frac {2 i \sqrt {x + 1}}{\sqrt {x - 1}} & \text {for}\: \left |{x + 1}\right | > 2 \\2 \operatorname {asin}{\left (\frac {\sqrt {2} \sqrt {x + 1}}{2} \right )} + \frac {\left (x + 1\right )^{\frac {3}{2}}}{\sqrt {1 - x}} - \frac {2 \sqrt {x + 1}}{\sqrt {1 - x}} & \text {otherwise} \end {cases} \]

[In]

integrate((1+x)**(1/2)/(1-x)**(1/2),x)

[Out]

Piecewise((-2*I*acosh(sqrt(2)*sqrt(x + 1)/2) - I*(x + 1)**(3/2)/sqrt(x - 1) + 2*I*sqrt(x + 1)/sqrt(x - 1), Abs
(x + 1) > 2), (2*asin(sqrt(2)*sqrt(x + 1)/2) + (x + 1)**(3/2)/sqrt(1 - x) - 2*sqrt(x + 1)/sqrt(1 - x), True))

Maxima [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.67 \[ \int \frac {\sqrt {1+x}}{\sqrt {1-x}} \, dx=-\sqrt {-x^{2} + 1} + \arcsin \left (x\right ) \]

[In]

integrate((1+x)^(1/2)/(1-x)^(1/2),x, algorithm="maxima")

[Out]

-sqrt(-x^2 + 1) + arcsin(x)

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.33 \[ \int \frac {\sqrt {1+x}}{\sqrt {1-x}} \, dx=-\sqrt {x + 1} \sqrt {-x + 1} + 2 \, \arcsin \left (\frac {1}{2} \, \sqrt {2} \sqrt {x + 1}\right ) \]

[In]

integrate((1+x)^(1/2)/(1-x)^(1/2),x, algorithm="giac")

[Out]

-sqrt(x + 1)*sqrt(-x + 1) + 2*arcsin(1/2*sqrt(2)*sqrt(x + 1))

Mupad [B] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.67 \[ \int \frac {\sqrt {1+x}}{\sqrt {1-x}} \, dx=\mathrm {asin}\left (x\right )-\sqrt {1-x^2} \]

[In]

int((x + 1)^(1/2)/(1 - x)^(1/2),x)

[Out]

asin(x) - (1 - x^2)^(1/2)